#include <climits>
#include <cmath>
#include <cstring>

#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <string>
#include <sstream>
#include <stack>
#include <queue>
using namespace std;

struct ListNode
{
    ListNode *next;
    int val;
    ListNode(int x) : val(x), next(nullptr) {}
};

struct RandomListNode
{
    int label;
    RandomListNode *next, *random;
    RandomListNode(int x) : label(x), next(nullptr), random(nullptr)
    {
    }
};

struct TreeNode
{
    int val;
    TreeNode *left, *right;
    TreeNode(int x)
        : val(x), left(nullptr), right(nullptr)
    {
    }
};